home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / ch01 / vdrtest.c < prev    next >
Text File  |  1993-12-06  |  1KB  |  47 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. #include DRIVER
  5.  
  6. GrDriverHeader driver_header;
  7.  
  8. void dump_modeinfo(GrModeEntry *md)
  9. {
  10.     char setup[40];
  11.  
  12.     printf(
  13.         "  Width=%-4d  Height=%-4d  Colors=%-8ld  BIOS mode=0x%03x  Setup=%s\n",
  14.         md->width,
  15.         md->height,
  16.         md->number_of_colors <= 32768U ?
  17.         (long)md->number_of_colors :
  18.         (1L << (md->number_of_colors & 0x0ff)),
  19.         md->mode.vdr.BIOS_mode,
  20.         md->mode.vdr.custom_setup_index == 0 ?
  21.         "STANDARD" :
  22.         (sprintf(setup,"%d",md->mode.vdr.custom_setup_index), setup)
  23.     );
  24. }
  25.  
  26. void main(void)
  27. {
  28.     printf(driver_name);
  29.     if(driver_init_routine()) {
  30.         GrModeEntry *tx = text_mode_table;
  31.         GrModeEntry *gr = graphics_mode_table;
  32.         printf("\ntext modes:\n");
  33.         while(tx->width > 0) {
  34.         dump_modeinfo(tx);
  35.         tx++;
  36.         }
  37.         printf("\ngraphics modes:\n");
  38.         while(gr->width > 0) {
  39.         dump_modeinfo(gr);
  40.         gr++;
  41.         }
  42.     }
  43.     else printf("\ndriver initialization routine failed\n");
  44.     exit(0);
  45. }
  46.  
  47.